@extends('layout.admin')

@section('title','分类添加')

@section('content')
	<div class="mws-panel grid_8">
                	<div class="mws-panel-header">
                    	<span>分类修改</span>
                    </div>
                    <div class="mws-panel-body no-padding">
						<!-- @if (count($errors)>0)
						<div class="alert alert-danger">
							<ul>
								@foreach ($errors->all() as $error)
									<li>{{$error}}</li>
								@endforeach
							</ul>

						</div>
						@endif -->


                    	<form action="/cate/update" method="post" enctype="multipart/form-data" class="mws-form">
                    		@if (count($errors)>0)
                    	<div class="mws-form-message error">

                    		出错了
                    		<ul>
								@foreach ($errors->all() as $error)
									<li>{{$error}}</li>
								@endforeach
							</ul>

						</div>
						@endif 

                    		<div class="mws-form-inline">
                    			<div class="mws-form-row">
                    				<label class="mws-form-label">分类名称 : </label>
                    				<div class="mws-form-item">
                    					
                                             <input type="text" name="name" class="small" value="{{$cate->name}}">
                    				      
                                        </div>
                    			</div>
                    			
                    			<div class="mws-form-row">
                    				<label class="mws-form-label">父级分类</label>
									<div class="mws-form-item">
										<select class="small" name="pid">
				                            <option value="0">请选择</option>
				                            @foreach($cates as $k=>$v)
				                            <option value="{{$v->id}}" @if($v->id == $cate->pid) selected @endif>
                                                  {{$v->name}}</option>
				                            @endforeach
				                        </select>
										
									</div>						

                    			</div>



                    			
                    			
                    		</div>
                    		<div class="mws-button-row">
								<input type="hidden" name="id" value="{{$cate->id}}">
								{{csrf_field()}}
                    			<input type="Submit" class="btn btn-danger" value="提交">
                    			<input type="Reset" class="btn " value="重置">
                    		</div>
                    	</form>
                    </div>    	
                </div>


@endsection

